package javaBase.nowcoder.HJ59_A_找出字符串中第一个只出现一次的字符;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/*

* */
public class Main {
    static HashMap<String, Integer> charNum = new HashMap<>();
    static int index = 0;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        index = str.length() - 1;
        br.close();
        if (index == 0) {
            System.out.println(str);
        } else {
            Arrays.asList(str.split("")).forEach(x -> {
                charNum.merge(x, 1, Integer::sum);
            });
            List<Map.Entry<String, Integer>> collect = charNum.entrySet().stream().filter(x -> {
                return x.getValue() == 1;
            }).collect(Collectors.toList());
            collect.forEach(s -> {
                index = index > str.lastIndexOf(s.getKey()) ? str.lastIndexOf(s.getKey()) : index;
            });
            System.out.println((index == str.length() - 1) ? "-1" : str.charAt(index));
        }


    }
}
